package com.eling.elcms.nursing.webapp.controller;

import com.eling.elcms.core.dao.hibernate.search.SearchCondition;
import com.eling.elcms.core.webapp.controller.BaseFormController;
import com.eling.elcms.core.webapp.controller.Msg;
import com.eling.elcms.core.webapp.spring.ModelFilling;
import com.eling.elcms.nursing.model.SignUpServContr;
import com.eling.elcms.nursing.service.ISignUpServContrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class SignUpServContrController extends BaseFormController{
	@Autowired
	private ISignUpServContrService signUpServContrService;
	
	@RequestMapping("/api/signupservcontr/search*")
	@ResponseBody
	public List<SignUpServContr> sreach(@ModelAttribute SearchCondition sc,@ModelAttribute SignUpServContr dishType) {
		sc.setQueryCondition(dishType);
		return signUpServContrService.search(sc); 
	}
	
	@RequestMapping("/api/signupservcontr/query")
    @ResponseBody
    public List<SignUpServContr> query(@ModelAttribute SignUpServContr cond){
    	return signUpServContrService.query(cond); 
    }
	
	@RequestMapping("/api/signupservcontr/save")
    @ResponseBody
    public SignUpServContr save(@ModelAttribute@ModelFilling SignUpServContr cond) {
		return signUpServContrService.save(cond);
    }
	
	@RequestMapping("/api/signupservcontr/{pkSignUpServContr}/delete")
	@ResponseBody
	public Msg delete(@PathVariable Long pkSignUpServContr) {
		signUpServContrService.remove(pkSignUpServContr);
	    return new Msg("删除成功");
	}

}
